package cn.xuexiyuan.kpi.mapper;

import cn.xuexiyuan.kpi.entity.UserEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @Description:
 * @Author 左龙龙
 * @Date 20-11-27
 * @Version 1.0
 **/
@Repository
public interface UserMapper {

    @Insert({ "insert into tb_user(user_name, password, user_type, region, sex, birthday) values(#{user_name}, #{password}, #{user_type}, #{region}, #{sex}, #{birthday})"})
    void insert(UserEntity user);

    @Select("select * from tb_user where user_name = #{user_name} limit 1")
    UserEntity findOneByName(String user_name);

    @Select("select id, user_name, user_type from tb_user where user_name = #{user_name} and password = #{password} limit 1")
    UserEntity findOne(UserEntity user);

}
